package Duoxiancheng;
//join插队
//join合并线程，待此线程执行完之后再执行其他线程，其他线程堵塞，可以想象成插队
public class Joins implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("run函数VIP来了"+i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        //启动我们的线程
        Joins joins=new Joins();
        Thread thread=new Thread(joins);
        thread.start();

        //主线程
        for (int i = 0; i < 100; i++) {
            if (i==50) {
                thread.join();
            }
            System.out.println("主函数"+i);
        }
    }
}
